cmake_minimum_required(VERSION 3.8)
project(opencv_pkg)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # comment the line when a copyright and license is added to all source files
  set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # comment the line when this package is in a git repo and when
  # a copyright and license is added to all source files
  set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()
################## find dependencies ##################
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(OpenCV REQUIRED)
find_package(pcl_conversions REQUIRED)
find_package(pcl_ros REQUIRED)
find_package(trajectory_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
################## node ##################
# rgb相机
add_executable(camera_rgb src/camera_rgb.cpp)
ament_target_dependencies(camera_rgb 
  "rclcpp" "sensor_msgs" "cv_bridge" "OpenCV" )
# RGB-D深度相机
add_executable(pallet_detect src/pallet_detect.cpp)
ament_target_dependencies(pallet_detect 
  "rclcpp" "sensor_msgs" 
  "cv_bridge" "OpenCV" 
  "pcl_conversions" "pcl_ros" 
  "geometry_msgs")
# 托盘插取
add_executable(pallet_pick src/pallet_pick.cpp)
ament_target_dependencies(pallet_pick 
  "rclcpp" "sensor_msgs" "trajectory_msgs" "geometry_msgs"
)
##################### test #####################
add_executable(pallet_pick_test src/pallet_pick_test.cpp)
ament_target_dependencies(pallet_pick_test 
  "rclcpp" "sensor_msgs" "trajectory_msgs" 
)
###################### install ##################
# 安装规则
install(TARGETS
  camera_rgb
  pallet_detect
  pallet_pick
  pallet_pick_test
  DESTINATION lib/${PROJECT_NAME})
# 安装目录
install(
  DIRECTORY
  launch
  DESTINATION share/${PROJECT_NAME}
)

ament_package()
